...\" $Header: /usr/src/docbook-to-man/cmd/RCS/docbook-to-man.sh,v 1.3 1996/06/17 03:36:49 fld Exp $
...\"
...\"	transcript compatibility for postscript use.
...\"
...\"	synopsis:  .P! <file.ps>
...\"
.de P!
\\&.
.fl			\" force out current output buffer
\\!%PB
\\!/showpage{}def
...\" the following is from Ken Flowers -- it prevents dictionary overflows
\\!/tempdict 200 dict def tempdict begin
.fl			\" prolog
.sy cat \\$1\" bring in postscript file
...\" the following line matches the tempdict above
\\!end % tempdict %
\\!PE
\\!.
.sp \\$2u	\" move below the image
..
.de pF
.ie     \\*(f1 .ds f1 \\n(.f
.el .ie \\*(f2 .ds f2 \\n(.f
.el .ie \\*(f3 .ds f3 \\n(.f
.el .ie \\*(f4 .ds f4 \\n(.f
.el .tm ? font overflow
.ft \\$1
..
.de fP
.ie     !\\*(f4 \{\
.	ft \\*(f4
.	ds f4\"
'	br \}
.el .ie !\\*(f3 \{\
.	ft \\*(f3
.	ds f3\"
'	br \}
.el .ie !\\*(f2 \{\
.	ft \\*(f2
.	ds f2\"
'	br \}
.el .ie !\\*(f1 \{\
.	ft \\*(f1
.	ds f1\"
'	br \}
.el .tm ? font underflow
..
.ds f1\"
.ds f2\"
.ds f3\"
.ds f4\"
.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n 
.TH "\fBflow-tools-examples\fP" "1"
.SH "NAME"
\fBflow-tools-examples\fP \(em Example usage of flow-tools\&.
.SH "EXAMPLE - Configuring Cisco IOS Router"
.PP
NetFlow is configured on each input interface, then global commands are
used to specify the export destination\&.  To ensure a consistant source
address address Loopback0 is configured as the export source\&.
.PP
.nf
\f(CWip cef distributed
ip flow-export version 5 origin-as
ip flow-export destination 10\&.0\&.0\&.100 5004
ip flow-export source Loopback0

interface Loopback0
 ip address 10\&.1\&.1\&.1 255\&.255\&.255\&.255

interface FastEthernet0/1/0 
 ip address 10\&.0\&.0\&.1 255\&.255\&.255\&.0
 no ip directed-broadcast
 ip route-cache flow
 ip route-cache distributed
\fR
.fi
.PP
 
Many other options exist such as aggregated NetFlow and sampled NetFlow which
are detailed at \fI (link to URL http://www.cisco.com) \fR\&.
.SH "EXAMPLE - Configuring Cisco CatIOS Switch"
.PP
Some Cisco Catalyst switches support a different implementation of NetFlow
that is performed on the supervisor\&.  With the cache based forwarding model
which is implemented in the Catalyst 55xx with Route Switch Module (RSM)
and NetFlow Feature Card (NFFC), the RSM processes the first flow and the
remaining packets in the flow are forwarded by the Supervisor\&.  This is
also implemented in the early versions of the 65xx with MSFC\&.  The
deterministic forwarding model used in the 65xx with MSFC2 do not use
NetFlow to determine the forwarding path, the flow cache is only used
for statistics as in the current IOS implementations\&.  In all of 
of the above configurations flow exports arrive from both the RSM/MSFC and
the Supervisor engines as distinct streams\&.  In the worst cast the RSM
exports in version 5 and the Supervisor exports in version 7\&.
Fortunately flow-capture and flow-receive can sort all this out by 
processing flows from both sources and converting them to a common 
export format\&.
.PP
The router side running IOS is configured identically to the example
given above\&.  The CatIOS NetFlow Data Export configuration follows:
.PP
.PP
.nf
\f(CWset mls flow full
set mls nde version 7
set mls nde 10\&.0\&.0\&.1 9800
set mls nde enable\fR
.fi
.PP
.PP
When the 65xx is running in Native mode, from a users perspective the 
switch is only running IOS\&.
.PP
More detailed examples can be found on Cisco\&'s web site 
\fI (link to URL http://www.cisco.com) \fR\&.
.SH "EXAMPLE - Configuring Juniper Router"
.PP
Juniper supports flow exports by the routing engine sampling packet
headers and aggregating them into flows\&.  Packet sampling is done by 
defining a firewall filter to accept and sample all traffic, 
applying that rule to the interface, then configuring the sampling
forwarding option\&.
.PP
.nf
\f(CWinterfaces {
    ge-0/3/0 {
        unit 0 {
            family inet {
                filter {
                    input all;
                    output all;
                }
                address 10\&.0\&.0\&.1/24;
            }
        }
    }

firewall {
    filter all {
        term all {
            then {
                sample;
                accept;
            }
        }
    }
}

forwarding-options {
    sampling {
        input {
            family inet {
                rate 100;
            }
        }
        output {
            cflowd 10\&.0\&.0\&.100 {
                port 9800;
                version 5;
            }
        }
    }
}\fR
.fi
.PP
.PP
Other options exist such as aggregated flows which 
are detailed at \fI (link to URL http://www.juniper.net) \fR\&.
.SH "EXAMPLE - Network topology and \fBflow\&.acl\fP"
.PP
The network topology and flow\&.acl will be used for many of the examples
that follow\&.  Flows are collected and stored in \fB/flows/R\fP\&.
.PP
.nf
                        ISP-A       ISP-B
                         +           +
                          +         +
            IP=10\&.1\&.2\&.1/24 +       + IP=10\&.1\&.1\&.1/24
                 ifIndex=2  +     +  ifIndex=1
       interface=serial1/1   +   +   interface=serial0/0
                             -----
                             | R | Campus Router
                             -----
                             +   +
           IP=10\&.1\&.4\&.1/24   +     +   IP=10\&.1\&.3\&.1/24
                ifIndex=4  +       +  ifIndex=3
    interface=Ethernet1/1 +         + interface=Ethernet0/0
                         +           +
                       Sales      Marketing
.fi
.PP
.nf
\f(CWip access-list standard sales permit 10\&.1\&.4\&.0 0\&.0\&.0\&.255
ip access-list standard not_sales deny 10\&.1\&.4\&.0 0\&.0\&.0\&.255
ip access-list standard marketing permit 10\&.1\&.3\&.0 0\&.0\&.0\&.255
ip access-list standard not_marketing deny 10\&.1\&.3\&.0 0\&.0\&.0\&.255
ip access-list standard campus permit 10\&.1\&.4\&.0 0\&.0\&.0\&.255
ip access-list standard campus permit 10\&.1\&.3\&.0 0\&.0\&.0\&.255
ip access-list standard not_campus deny 10\&.1\&.4\&.0 0\&.0\&.0\&.255
ip access-list standard not_campus deny 10\&.1\&.3\&.0 0\&.0\&.0\&.255
ip access-list standard evil_hacket permit host 10\&.6\&.6\&.6
ip access-list standard spoofer permit host 10\&.9\&.9\&.9
ip access-list standard multicast 224\&.0\&.0\&.0 15\&.255\&.255\&.255\fR
.fi
.PP
.SH "EXAMPLE - Finding spoofed addresses"
.PP
A common problem on the Internet is the use of "spoofed" (addresses
that are not assigned to an organization) for use in DoS attacks or 
compromising servers that rely on the source IP address for authentication\&.
.PP
Display all flow records that originate from the campus and are sent
to the Internet but are not using legal addresses\&.
.PP
\fBflow-cat /flows/R | flow-filter -Snot_campus -I1,2 | flow-print\fP
.PP
Summary of the destinations of the internally spoofed addresses sorted by octets\&.
.PP
\fBflow-cat /flows/R | flow-filter -Snot_campus -I1,2 | flow-stat -f8 -S2\fP
.PP
Summary of the sources of the internally spoofed addresses sorted by flows\&.
.PP
\fBflow-cat /flows/R | flow-filter -Snot_campus -I1,2 | flow-stat -f9 -S1\fP
.PP
Summary of the internally spoofed sources and destination pairs sorted by packets\&.
.PP
\fBflow-cat /flows/R | flow-filter -Snot_campus -I1,2 | flow-stat -f10 -S4\fP
.PP
Display all flow records that originate external to the campus that have
campus addresses\&.  Many times these can be attackers trying to exploit host
based authentication mechanisms like unix r* commands\&.  Another common
source is mobile clients which send packets with their campus addresses
before obtaining a valid IP\&.
.PP
\fBflow-cat /flows/R | flow-filter -Scampus -i1,2 | flow-print\fP
.PP
Summary of the destinations of the externally spoofed addresses sorted by octets\&.
.PP
\fBflow-cat /flows/R | flow-filter -Scampus -i1,2 | flow-stat -f8 -S2\fP
.SH "EXAMPLE - Locate hosts using or running services"
.PP
Find all SMTP servers active during the collection period
that have established connections to the Internet\&.  Summarize sorted
by octets\&.
.PP
\fBflow-cat /flows/R | flow-filter -I1,2 -P25 | flow-stat -f9 -S2\fP
.PP
Find all outbound NNTP connections to the Internet\&.  Summarize with source
and destination IP sorted by octets\&.
.PP
\fBflow-cat /flows/R | flow-filter -I1,2 -P119 | flow-stat -f10 -S3\fP
.PP
Find all inbound NNTP connections to the Internet\&.  Summarize with source
and destination IP sorted by octets\&.
.PP
\fBflow-cat /flows/R | flow-filter -i1,2 -P119 | flow-stat -f10 -S3\fP
.SH "EXAMPLE - Multicast usage"
.PP
Summarize Multicast S,G where sources are on campus\&.
.PP
\fBflow-cat /flows/R | flow-filter -Dmulticast -I1,2 | flow-stat -f10 -S3\fP
.PP
Summarize Multicast S,G where sources are off campus\&.
.PP
\fBflow-cat /flows/R | flow-filter -Dmulticast -i1,2 | flow-stat -f10 -S3\fP
.SH "EXAMPLE - Find scanners"
.PP
Find SMTP scanners with flow-dscan\&.  This will also find SMTP clients which
try to contact many servers\&.  This behavior is characterized by a 
recent Microsoft worm\&.
.PP
.PP
.nf
\fBtouch dscan\&.suppress\&.src dscan\&.suppress\&.dst\fP 
\fBflow-cat /flows/R | flow-filter -P25 | flow-dscan -b\fP
.fi
.SH "AUTHOR"
.PP
Mark Fullmer maf@splintered\&.net
.SH "SEE ALSO"
.PP
\fBflow-tools\fP(1)
...\" created by instant / docbook-to-man, Sat 08 Jun 2002, 23:41
